<?php

/**
 * This is the model class for table "bln_app_onlinequeue_service_queueline_timeresource".
 *
 * The followings are the available columns in table 'bln_app_onlinequeue_service_queueline_timeresource':
 * @property integer $_id
 * @property string $cycle_length
 * @property string $cycle_period
 * @property string $timeslot_length
 * @property string $allocate_queue_strategy
 * @property integer $service_queueline_id
 * @property integer $cycle_repeat_times
 * @property integer $start_time
 * @property integer $end_time
 * @property string $makequeue_offset_to_endtime
 * @property string $makequeue_cycle_length
 * @property string $makequeue_cycle_period
 * @property string $makequeue_timeslot_length
 * @property string $processqueue_offset_to_endtime
 * @property string $processqueue_cycle_period
 * @property string $processqueue_cycle_length
 * @property string $processqueue_timeslot_length
 * @property string $data
 */
class BMServiceQueueLineTimeResource extends BAppDbActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return BMServiceQueueLineTimeResource the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'bln_app_onlinequeue_service_queueline_timeresource';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('cycle_length, cycle_period, allocate_queue_strategy, service_queueline_id', 'required'),
			array('service_queueline_id, cycle_repeat_times, start_time, end_time', 'numerical', 'integerOnly'=>true),
			array('cycle_length, timeslot_length, allocate_queue_strategy, makequeue_offset_to_endtime, makequeue_cycle_length, makequeue_timeslot_length, processqueue_offset_to_endtime, processqueue_cycle_length, processqueue_timeslot_length', 'length', 'max'=>100),
			array('makequeue_cycle_period, processqueue_cycle_period, data', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('_id, cycle_length, cycle_period, timeslot_length, allocate_queue_strategy, service_queueline_id, cycle_repeat_times, start_time, end_time, makequeue_offset_to_endtime, makequeue_cycle_length, makequeue_cycle_period, makequeue_timeslot_length, processqueue_offset_to_endtime, processqueue_cycle_period, processqueue_cycle_length, processqueue_timeslot_length, data', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'_id' => 'ID',
			'cycle_length' => 'Cycle Length',
			'cycle_period' => 'Cycle Period',
			'timeslot_length' => 'Timeslot Length',
			'allocate_queue_strategy' => 'Allocate Queue Strategy',
			'service_queueline_id' => 'Service Queueline',
			'cycle_repeat_times' => 'Cycle Repeat Times',
			'start_time' => 'Start Time',
			'end_time' => 'End Time',
			'makequeue_offset_to_endtime' => 'Makequeue Offset To Endtime',
			'makequeue_cycle_length' => 'Makequeue Cycle Length',
			'makequeue_cycle_period' => 'Makequeue Cycle Period',
			'makequeue_timeslot_length' => 'Makequeue Timeslot Length',
			'processqueue_offset_to_endtime' => 'Processqueue Offset To Endtime',
			'processqueue_cycle_period' => 'Processqueue Cycle Period',
			'processqueue_cycle_length' => 'Processqueue Cycle Length',
			'processqueue_timeslot_length' => 'Processqueue Timeslot Length',
			'data' => 'Data',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('_id',$this->_id);
		$criteria->compare('cycle_length',$this->cycle_length,true);
		$criteria->compare('cycle_period',$this->cycle_period,true);
		$criteria->compare('timeslot_length',$this->timeslot_length,true);
		$criteria->compare('allocate_queue_strategy',$this->allocate_queue_strategy,true);
		$criteria->compare('service_queueline_id',$this->service_queueline_id);
		$criteria->compare('cycle_repeat_times',$this->cycle_repeat_times);
		$criteria->compare('start_time',$this->start_time);
		$criteria->compare('end_time',$this->end_time);
		$criteria->compare('makequeue_offset_to_endtime',$this->makequeue_offset_to_endtime,true);
		$criteria->compare('makequeue_cycle_length',$this->makequeue_cycle_length,true);
		$criteria->compare('makequeue_cycle_period',$this->makequeue_cycle_period,true);
		$criteria->compare('makequeue_timeslot_length',$this->makequeue_timeslot_length,true);
		$criteria->compare('processqueue_offset_to_endtime',$this->processqueue_offset_to_endtime,true);
		$criteria->compare('processqueue_cycle_period',$this->processqueue_cycle_period,true);
		$criteria->compare('processqueue_cycle_length',$this->processqueue_cycle_length,true);
		$criteria->compare('processqueue_timeslot_length',$this->processqueue_timeslot_length,true);
		$criteria->compare('data',$this->data,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}